home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / CIncludes / stdiostr.h < prev    next >
Encoding:
Text File  |  1994-12-14  |  879 b   |  48 lines  |  [TEXT/MPS ]

  1. //     IOStreams Package
  2. //     Steve Teale April 1992
  3. //     Copyright Symantec Corp 1990-1992. All Rights Reserved.
  4. //
  5. //    Some portions Copyright © 1994 Apple Computer Inc.
  6.  
  7. #ifndef __STDIOSTR__
  8. #define __STDIOSTR__
  9.  
  10. #include <stdio.h>
  11. #include <iostream.h>
  12.  
  13. class stdiobuf : public streambuf {
  14. public:
  15.     stdiobuf(FILE*);
  16.     FILE* stdiofile() { return fp; }
  17.     ~stdiobuf();
  18.  
  19.     int  underflow();
  20. #if __ZTC__ > 0x214
  21.     int  overflow(int=EOF);
  22. #else
  23.     int overflow(int);
  24. #endif
  25.     int  pbackfail(int);
  26.  
  27. private:
  28.     FILE*   fp;
  29.     char *gptr_;
  30.     char *egptr_;
  31.                 // Save old gptr() & egptr() while using the
  32.                 // pushback buffer.
  33.     char pushback_buf[4];
  34.     int fillbuf();
  35. };
  36.  
  37. class stdiostream : public ios {
  38. public:
  39.     stdiostream(FILE*);
  40.     ~stdiostream();
  41.     stdiobuf* rdbuf() { return &buffer; }
  42.  
  43. private:
  44.     stdiobuf buffer;
  45. };
  46.  
  47. #endif
  48.